.TH std::owner_hash 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::owner_hash \- std::owner_hash

.SH Synopsis
   Defined in header <memory>
   struct owner_hash;          (since C++26)

   This function object provides owner-based (as opposed to value-based) hashing of
   both std::weak_ptr and std::shared_ptr.

.SH Member functions

   operator() calculates the hash of the shared-ownership pointer
              \fI(function)\fP

std::owner_hash::operator()

   template< class T >
   std::size_t operator()( const std::shared_ptr<T>& key ) const      \fB(1)\fP (since C++26)
   noexcept;
   template< class T >
   std::size_t operator()( const std::weak_ptr<T>& key ) const        \fB(2)\fP (since C++26)
   noexcept;

   Equivalent to return key.owner_hash();.

.SH Parameters

   key - shared-ownership pointer to be hashed

.SH Return value

   A hash value that is identical for any std::shared_ptr or std::weak_ptr object
   sharing the same ownership.

.SH Notes

           Feature-test macro          Value    Std                Feature
                                                      Enabling the use of
   __cpp_lib_smart_ptr_owner_equality 202306L (C++26) std::shared_ptr and std::weak_ptr
                                                      as keys in unordered associative
                                                      containers

.SH See also

   owner_hash provides owner-based hashing of shared pointers
   (C++26)    \fI(public member function of std::shared_ptr<T>)\fP
   owner_hash provides owner-based hashing of weak pointers
   (C++26)    \fI(public member function of std::weak_ptr<T>)\fP
